package thread;

public class DaemonThreadDemo {
    public static void main(String[] args) {
        Thread ros=new Thread(){
            public void run(){
                for (int i=0;i<5;i++) {
                    System.out.println("ros:"+"lit me go");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                System.out.println("扑通");
            }
        };
        Thread jock=new Thread(){
            public void run(){
                for (int i=0;i<5;i++) {
                    System.out.println("jock:"+"you jump,I jump");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        };
        ros.start();
        jock.setDaemon(true);
        jock.start();
    }
}
